1. Passing props as children

![|800](/img/user/Notes/React/attachments/Pasted image 20250516161146.png)

![|800](/img/user/Notes/React/attachments/Pasted image 20250516161241.png)


Making a button as a prop passing the function

![|800](/img/user/Notes/React/attachments/Pasted image 20250516163815.png)

You're doing 3 key things correctly in your code — here's a breakdown in simple terms:

✅ 1. Passing a function and text as props
In App.jsx, you're passing:

<Cards handle={handleClick} text="clickme">

✅ 2. Passing children (JSX content)
Inside <Cards>...</Cards>, you're placing:

<h1>{count}</h1>

This JSX becomes props.children in the Cards component.
So props.children = <h1>{count}</h1>


✅ 3. Using everything properly in Cards.jsx
In Cards.jsx:

<>
  {props.children}       // shows <h1>{count}</h1>
  <button onClick={props.handle}>
    {props.text}         // shows "clickme"
  </button>
</>
Prop What you passed How it's used
handle handleClick function Runs on onClick of button
text "clickme" Displayed as button text
children <h1>{count}</h1> Rendered inside the component

More

2. State lifting
3. UseEffect
4. Context API